#include<iostream>
#include<set>
#include<algorithm>
#include<map>

using namespace std;

void test()
{
 
  set<int> s;
  s.insert(1);
  s.insert(1);
  s.insert(1);
  s.insert(1);
  s.insert(1);
  s.insert(1);
  s.insert(3);
  s.insert(1);
  s.insert(2);
  s.insert(4);
  s.erase(4);
  set<int>::iterator pos = s.find(3);
  if(pos!=s.end())
  {
    s.erase(pos);
  }
  
  for(auto e:s)
  {
    cout<<e<<"  ";
  }
  cout<<endl;

  s.insert(0);
  s.insert(8);
  s.insert(5);

 set<int>::iterator it = s.begin();
 while(it!=s.end())
 {
   cout<<*it<<"  ";
   it++;
 }
 cout<<endl;

 set<int>::reverse_iterator rit = s.rbegin();
 while(rit!=s.rend())
 {
   cout<<*rit<<"  ";
   rit++;
 }
 cout<<endl;

 cout<<s.count(1)<<endl;

 multiset<int> ms;
 ms.insert(1);
 ms.insert(1);
 ms.insert(1);
 ms.insert(1);
 ms.insert(1);
 ms.insert(1);
 ms.insert(1);

 multiset<int>::iterator mit = ms.begin();
 while(mit!=ms.end())
 {
   cout<<*mit<<"  ";
   mit++;
 }
 cout<<endl;


}

void test1()
{
 map<int,string> m;
 m.insert(pair<int,string>(2,"two"));
 m.insert(pair<int,string>(3,"three"));
 m.insert(pair<int,string>(4,"four"));
 m.insert(make_pair(5,"five"));
 map<int,string>::iterator pos = m.find(2);
 if(pos!=m.end())
 {

   cout<<pos->first<<"  "<<pos->second<<endl;
 }

  //m.erase(3);
  m[2] = "two two";
  m[9] = "nine";
 for(auto e:m)
 {
   cout<<e.first <<" "<<e.second<<endl;
 }

}

int main()
{

   test1();

  return 0;
}
